
#include <iostream>
#include <string>
#include <cstring>


using namespace std;
char * getname(void);
	
int main()
{
	char * name;
	
	name = getname();
	cout << name <<" at " << (int *)name << "\n";
	delete [] name;
	
	name = getname();
	cout << name <<" at " << (int *)name << "\n";
	delete [] name;
		
    return 0;
}

char * getname(void)
{
	char temp[80];
	cout << "Enter last name: ";
	cin >> temp;//这会出现一个bug，输出的字符必须是一连串的 ，中间不能有空格 
	//cin.getline(temp,strlen(temp) ); //这个不行
    //cin.getline(temp, 6 ); //这个需要提前预知输入字符的长度，包括空格和最后的空字符 
	char * pr = new char[strlen(temp) + 1];
	strcpy(pr, temp);
	
	return pr;
}
